package com.wwu.common.enums;

/**
 * 星期枚举类
 * @param null
 * @return null
 * @author 一蓑烟雨
 * @date 2023/8/2 15:29
 */
public enum WeekEnum {

    //枚举常量
    SECONDS("1", "星期天", "Sunday "),
    MONDAY("2", "星期一", "Monday "),
    TUESDAY("3", "星期二", "Tuesday "),
    WEDNESDAY("4","星期三", "Wednesday "),
    THURSDAY("5", "星期四", "Thursday "),
    FRIDAY("6", "星期五", "Friday "),
    SATURDAY("7", "星期六", "Saturday ");

    private String key;
    private String nameCn;
    private String nameEn;

    public String getKey() {
        return key;
    }

    public String getNameCn() {
        return nameCn;
    }

    public String getNameEn() {
        return nameEn;
    }

    /**
     * 构造器
     * @param key
     * @param nameCn
     * @param nameEn
     */
    WeekEnum(String key, String nameCn, String nameEn){
        this.key = key;
        this.nameCn = nameCn;
        this.nameEn = nameEn;
    }

    /**
     * 根据键获取中文星期方法
     * @param code
     * @return
     */
    public static String matchNameCn(String code){
        for(WeekEnum m : WeekEnum.values()){
            if(m.getKey().equals(code)){
                return m.getNameCn();
            }
        }
        return "";
    }

    /**
     * 根据键获取英文星期方法
     * @param code
     * @return
     */
    public static String matchNameEn(String code){
        for(WeekEnum m : WeekEnum.values()){
            if(m.getKey().equals(code)){
                return m.getNameEn();
            }
        }
        return "";
    }
}